package com.ssm.demo.service.base;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class BaseBean implements Serializable {
    private String id;
    @JsonIgnore
    private int start = -1;
    @JsonIgnore
    private int limit = -1;
    @JsonIgnore
    private String orderByClause;

    private Map<String, Object> paraMap = new HashMap<>();
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public String getOrderByClause() {
        return orderByClause;
    }

    public void setOrderByClause(String orderByClause) {
        this.orderByClause = orderByClause;
    }

    public Map<String, Object> getParaMap() {
        return paraMap;
    }

    public void setUuid() {
        setId(UUID.randomUUID().toString());
    }

    public void addParam(String key, Object value) {
        this.paraMap.put(key, value);
    }

    public Object getParam(String key) {
        return this.paraMap.get(key);
    }

    public int getEndIndex() {
        return this.start + this.limit - 1;
    }
}
